package cn.edu.tju.ldj.cashup.mailer;

public class Mailer {
	
	public boolean sendMail(String address,String subject,String content){
		// 这个类主要是设置邮件
		MailSenderInfo mailInfo = new MailSenderInfo();
		mailInfo.setMailServerHost("smtp.126.com");
		mailInfo.setMailServerPort("25");
		mailInfo.setValidate(true);
//		mailInfo.setUserName("tjukkmailer@163.com");
//		mailInfo.setPassword("900910");// 您的邮箱密码
//		mailInfo.setUserName("zhongshanbbb@163.com");
//		mailInfo.setPassword("zhongshan123");// 您的邮箱密码
		mailInfo.setUserName("cashup@126.com");
		mailInfo.setPassword("cashup123");// 您的邮箱密码
		mailInfo.setFromAddress("cashup@126.com");
		mailInfo.setToAddress(address);
		mailInfo.setSubject(subject);
		mailInfo.setContent(content);
		// 这个类主要来发送邮件
		SimpleMailSender sms = new SimpleMailSender();
		sms.sendTextMail(mailInfo);// 发送文体格式
//		sms.sendHtmlMail(mailInfo);// 发送html格式
		return true;
	}
	
	public static void main(String[] args) {
		Mailer m = new Mailer();
		m.sendMail("13820522653@139.com", "警报", "绿色-" + "↓" + 10.00
				+ ",AU:$" + 1320.21 + ";AG:$" + 20.21 + ";OIL$" + 102.12
				+ ";USD:$"+100.12+".");
	}
}
